<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>后台管理系统-健康用户管理</title>

<link rel="stylesheet" type="text/css" href="resources/css/health_user.css">
<%@ include  file="../includes/icon.html" %>
</head>
<body>

   <div class="headbar">
        
   </div>
   <div class="linkbar">
       <div>
        <span style="display:inline-block;width:80%;float:left;color:white;line-height:40px;">
            <a class="linkbar_a" href="admin/searchHealthUser">数据手工录入</a> | <a class="linkbar_a" href="admin/queryAutoInput">数据自动录入</a> 
        </span>
        <span style="display:inline-block;width:20%;float:right;color:white;line-height:40px;">
            <a class="linkbar_a" href="doctor/diagnoseBrainTumour" style="float:right;padding-right:30px">在线诊断</a>
        </span>
       </div> 
   </div>
   <div class="body">
       
         <table class="body">
           <tr>
              <td class="nav_list"  valign="top">
                <div> 
                   <dl class="nav_list">
                      <dd class="selected" ><a href="admin/searchHealthUser">病人信息</a></dd>
                      <dd class="no-selected" ><a href="admin/queryMedicalCase">疾病实例</a></dd>
                      <dd class="no-selected" ><a href="admin/queryTreatmentMethod">治疗方法</a></dd>
                      <dd class="no-selected" ><a href="admin/queryDesease">疾病表</a></dd>
                      <dd class="no-selected" ><a href="admin/queryFeature">特征表</a></dd>
                      <dd class="no-selected" ><a href="admin/queryLabSheet">化验单定义</a></dd>
                      <dd class="no-selected" ><a href="admin/queryLabSheetResult">化验单结果</a></dd>
                      <dd class="no-selected" ><a href="admin/queryMedicine">药物表</a></dd>
                      <dd class="no-selected" ><a href="admin/querySystemUser">系统用户</a></dd>
                      <dd class="no-selected" ><a href="admin/queryCity">城市表</a></dd>
                      <dd class="no-selected" ><a href="admin/queryOccupation">职业表</a></dd>
                      <dd class="no-selected" ><a href="admin/queryBodyPart">身体部位表</a></dd>
                   </dl>
                </div>
              </td>
              <td class="content" valign="top">
                  
                  <div class="search_bar"> 
                    <sf:form action="admin/searchHealthUser" method="POST" modelAttribute="condition"> 
                    <span class="search_condition">
                       <div style="width:100%;margin-left:30px;margin-top:20px;">
                           <font>姓名： </font><sf:input path="name"  style="width:120px;" placeholder="输入姓名" id="condition_name" />
                           <font>身份证号： </font><sf:input path="id_number"  style="width:150px;" placeholder="输入身份证号码" id="condition_id_number" />
                           <font>性别：</font><sf:select path="sexuality"  style="width:124px;" placeholder="输入性别" id="condition_sexuality">
                           						  <sf:option value="3">全部</sf:option>
                                                  <sf:option value="0">男</sf:option>
                                                  <sf:option value="1">女</sf:option>
                                             </sf:select>
                           <font>出生日期：</font><sf:input path="birth_datetime_string"  style="width:120px;" placeholder="输入出生日期" id="condition_birth_datetime_string" />
                      </div>
                    
                      <div style="width:100%;margin-left:30px;margin-top:10px;">
                          <font>职业：</font><sf:input path="occupation_string" style="width:120px;" id="condition_occupation_string" />
                            					
                          <font>出生城市：</font><sf:input path="born_place_string" style="width:120px;"   id="condition_born_place_string" />
                          						 
                          <font>长居城市：</font><sf:input path="residence_place_string" style="width:120px;"   id="condition_residence_place_string" />
                         					 
                          <font>现居城市：</font><sf:input path="now_place_string" style="width:120px;"   id="condition_now_place_string" />
                         					     
                      </div>
                
                      
                    </span>
                    <span class="search_button">
                         <input type="submit" class="search_button" value="查询">
                    </span>
                    </sf:form>
                  </div>
                  
                  
                  
                  <script language="javascript"> 
                    var isShown = false;
                    var needShown= ${isAddNewShow};
                    function clickAddDiv()
                    {
                    	if (isShown == false)
                    	{	
                    		showAddDiv();
                    		
                    	}
                    	else
                    	{
                    		hideAddDiv();
                    	}
                    }
					function showAddDiv() {

					  d=document.getElementById("add_new_health_user");
					  d.style.display="inline-block";
					  
					  isShown =true;
					}
					function hideAddDiv() {

						  d=document.getElementById("add_new_health_user");
						  d.style.display="none";
						  document.getElementById("error").style.display ="none";
						  isShown = false;
				    }
					
				 </script> 
                  
                  
                  <div class="status_bar">
                     <div style="display:block;float:left">搜索结果：</div>   <div class="add_new_button" onClick="clickAddDiv()" >添加+</div>
                  </div>
                  
                  <div class="add_new_health_user" id="add_new_health_user">
                     <sf:form action="admin/addHealthUser" method="POST" modelAttribute="new_health_user"> 
                    <span class="add_new_health_user">
                       <div style="width:100%;margin-left:30px;margin-top:17px;">
                           <font>姓名： </font><sf:input path="name"  style="width:120px;" placeholder="输入姓名"  id="condition_name"  />
                           <font>身份证号： </font><sf:input path="id_number"  style="width:150px;" placeholder="输入身份证号码" id="condition_id_number"  />
                           <font>性别： </font><sf:select path="sexuality"  style="width:124px;" placeholder="输入性别" id="condition_sexuality" >
                                                  <sf:option value="0">男</sf:option>
                                                  <sf:option value="1">女</sf:option>
                                             </sf:select>
                           <font>出生日期：</font><sf:input path="birth_datetime_string"  style="width:120px;" placeholder="输入出生日期" id="condition_birth_datetime_string"  />
                      </div>
                      <div  class = "error"  >
                         <div id="error">
                          <div class="name_error"><font ><sf:errors path="name" cssClass="error_font"  /></font></div>
                          <div class="id_number_error"><sf:errors path="id_number" cssClass="error_font" /></font></div>
                      	 </div>
                      </div>
                      <div style="width:100%;margin-left:30px;margin-top:2px;">
                          <font>职业：</font><sf:select path="occupation_string" style="width:120px;" id="condition_occupation_string" >
                            						<c:forEach var="occupation" items="${occupation_list}" >
                            								<sf:option value="${occupation.occupation_name}">${occupation.occupation_name}</sf:option>
                            						</c:forEach>
                          					</sf:select>
                          <font>出生城市：</font><sf:select path="born_place_string" style="width:120px;"   id="condition_born_place_string">
                          							<c:forEach var="city" items="${city_list}" >
                            								<sf:option value="${city.city_name}">${city.city_name}</sf:option>
                            						</c:forEach>
                          						</sf:select>
                          <font>长居城市：</font><sf:select path="residence_place_string" style="width:120px;"   id="condition_residence_place_string" >
                         					    <c:forEach var="city" items="${city_list}" >
                            								<sf:option value="${city.city_name}">${city.city_name}</sf:option>
                            						</c:forEach>
                          						</sf:select>
                          <font>现居城市：</font><sf:select path="now_place_string" style="width:120px;"   id="condition_now_place_string" >
                         					    <c:forEach var="city" items="${city_list}" >
                            								<sf:option value="${city.city_name}">${city.city_name}</sf:option>
                            						</c:forEach>
                          						</sf:select>
                         </div>
                    </span>
                    <span class="add_button">
                          <input type="submit" class="add_button" value="添加" />
                          <div class="add_button">
                              <font style="color:blue;font-size:15px;" onclick="hideAddDiv()" >取消</font>
                          </div>
                    </span>
                    </sf:form>
                  </div>
                  
                  <div class="information" id="information">
                     ${information} 
                  </div>
                  
                  
                  <div class="user_list">
                     <div class="row"> 
                         <span style="width:120px">序号</span>
	                     <span style="width:100px">姓名</span>
	                     <span style="width:60px">性别</span>
	                     <span style="width:180px">身份证号</span>
	                     <span style="width:120px">职业</span>
	                     <span style="width:100px">现居城市</span>
	                     <span style="width:120px">出生日期</span>
	                     <span style="width:250px">操作</span>
                     </div>
                     
                      <script language="javascript">
			                    function clickEditDiv(id)
			                    {
			                    	if (document.getElementById("edit_health_user"+id).style.display=='none')
			                    	{	
			                    		showEditDiv(id);
			                    	}
			                    	else
			                    	{
			                    		hideEditDiv(id);
			                    	}
			                    }
								function showEditDiv(id) {
			
								  d=document.getElementById("edit_health_user"+id);
								  d.style.display="inline-block";
								  isShown =true;
								}
								function hideEditDiv(id) {
			
									  d=document.getElementById("edit_health_user"+id);
									  d.style.display="none";
									  document.getElementById("error").style.display ="none";
									  isShown = false;
							    }
								
								function clickDetailDiv(id)
			                    {
			                    	if (document.getElementById("detail_health_user"+id).style.display=='none')
			                    	{	
			                    		showDetailDiv(id);
			                    	}
			                    	else
			                    	{
			                    		hideDetailDiv(id);
			                    	}
			                    }
								function showDetailDiv(id) {
			
								  d=document.getElementById("detail_health_user"+id);
								  d.style.display="inline-block";
								  isShown =true;
								}
								function hideDetailDiv(id) {
			
									  d=document.getElementById("detail_health_user"+id);
									  d.style.display="none";
									  document.getElementById("error").style.display ="none";
									  isShown = false;
							    }
				           </script> 
                     
                     <c:forEach var = "health_user_item"   items= "${health_user_list}"  varStatus="xh">
                     
                         <div class="row">
							     <span style="width:120px">${xh.count}</span>
			                     <span style="width:100px">${health_user_item.name}</span>
			                     <span style="width:60px">${health_user_item.sexuality_string}</span>
			                     <span style="width:180px">${health_user_item.id_number}</span>
			                     <span style="width:120px">${health_user_item.occupation_string}</span>
			                     <span style="width:100px">${health_user_item.now_place_string}</span>
			                     <span style="width:120px">${health_user_item.birth_datetime_string}</span>
			                     <span style="width:250px">
			                        <a class="operation"  onClick="clickDetailDiv(${health_user_item.health_user_id})" >详情</a>
			                        <a class="operation"  onClick="clickEditDiv(${health_user_item.health_user_id})" >编辑</a>
			                        <a class="operation" href="admin/queryMedicalCase?id_number=${health_user_item.id_number}">查看病例</a>
			                     </span>  
                    	 </div>
                    	 
                    	 <div class="edit_health_user" id="edit_health_user${health_user_item.health_user_id}" style="display:${health_user_item.displayName}">
		                   <sf:form action="admin/editHealthUser" method="POST" modelAttribute="edit_health_user"> 
		                    <span class="add_new_health_user">
		                       <sf:input path="health_user_id" type="hidden" value="${health_user_item.health_user_id}" />
		                       <div style="width:100%;margin-left:30px;margin-top:17px;">
		                           <font>姓名：</font><sf:input path="name"  style="width:120px;" placeholder="输入姓名"  id="condition_name" value="${health_user_item.name}" />
		                           <font>身份证号：</font><sf:input path="id_number"  style="width:150px;" placeholder="输入身份证号码" id="condition_id_number" value="${health_user_item.id_number}" />
		                           <font>性别：</font><sf:select path="sexuality"  style="width:124px;" placeholder="输入性别" id="condition_sexuality">
		                                                  <c:if test="${health_user_item.sexuality==0}">
		                                                        <sf:option value="0" selected="selected">男</sf:option>
		                                                 	    <sf:option value="1">女</sf:option>
		                                                  </c:if>
		                                                   <c:if test="${health_user_item.sexuality==1}">
		                                                        <sf:option value="0" >男</sf:option>
		                                                 	    <sf:option value="1" selected="selected">女</sf:option>
		                                                  </c:if>
		                                             </sf:select>
		                           <font>出生日期：</font><sf:input path="birth_datetime_string"  style="width:120px;" placeholder="输入出生日期" id="condition_birth_datetime_string" value="${health_user_item.birth_datetime_string}" />
		                      </div>
		                      <div  class = "error"  >
		                         <div id="error">
		                          <div class="name_error"><font ><sf:errors path="name" cssClass="error_font"  /></font></div>
		                          <div class="id_number_error"><sf:errors path="id_number" cssClass="error_font" /></font></div>
		                      	 </div>
		                      </div>
		                      <div style="width:100%;margin-left:30px;margin-top:2px;">
		                    	  <font>职业：</font><sf:select path="occupation_string" style="width:120px;" id="condition_occupation_string" >
                            						<c:forEach var="occupation" items="${occupation_list}" >
                            						      <c:if test="${occupation.occupation_name==health_user_item.occupation_string}">
                            						      		<sf:option value="${occupation.occupation_name}" selected="selected">${occupation.occupation_name}</sf:option>
                            						      </c:if>
                            						      <c:if test="${occupation.occupation_name!=health_user_item.occupation_string}">
                            						            <sf:option value="${occupation.occupation_name}" >${occupation.occupation_name}</sf:option>
                            						      </c:if>
                            						</c:forEach>
		                          					</sf:select>
		                          <font>出生城市：</font><sf:select path="born_place_string" style="width:120px;"   id="condition_born_place_string">
		                          							<c:forEach var="city" items="${city_list}" >
		                          							  		 <c:if test="${city.city_name==health_user_item.born_place_string}">
			                            						      		<sf:option value="${city.city_name}" selected="selected">${city.city_name}</sf:option>  
			                            						      </c:if>
			                            						      <c:if test="${city.city_name!=health_user_item.born_place_string}">
			                            						          <sf:option value="${city.city_name}">${city.city_name}</sf:option>
			                            						      </c:if>
		                            								
		                            						</c:forEach>
		                          						</sf:select>
		                          <font>长居城市：</font><sf:select path="residence_place_string" style="width:120px;"   id="condition_residence_place_string" >
		                         					    <c:forEach var="city" items="${city_list}" >
		                            								 <c:if test="${city.city_name==health_user_item.residence_place_string}">
			                            						      		<sf:option value="${city.city_name}" selected="selected">${city.city_name}</sf:option>  
			                            						      </c:if>
			                            						      <c:if test="${city.city_name!=health_user_item.residence_place_string}">
			                            						          <sf:option value="${city.city_name}">${city.city_name}</sf:option>
			                            						      </c:if>
		                            						</c:forEach>
		                          						</sf:select>
		                          <font>现居城市：</font><sf:select path="now_place_string" style="width:120px;"   id="condition_now_place_string" >
		                         					    <c:forEach var="city" items="${city_list}" >
		                            								 <c:if test="${city.city_name==health_user_item.now_place_string}">
			                            						      		<sf:option value="${city.city_name}" selected="selected">${city.city_name}</sf:option>  
			                            						      </c:if>
			                            						      <c:if test="${city.city_name!=health_user_item.now_place_string}">
			                            						          <sf:option value="${city.city_name}">${city.city_name}</sf:option>
			                            						      </c:if>
		                            						</c:forEach>
		                          						</sf:select>
		                      </div>
		                    </span>
		                    <span class="add_button">
		                          <input type="submit" class="add_button" value="确认" />
		                          <div class="add_button">
		                              <font style="color:blue;font-size:15px;" onclick="hideEditDiv(${health_user_item.health_user_id})" >取消</font>
		                          </div>
		                    </span>
		                    </sf:form>
		                  </div>
		                  
		                  
		                  <div class="detail_health_user" id="detail_health_user${health_user_item.health_user_id}" style="display:none">
		
		                    <span class="add_new_health_user">
		                       <input type="hidden" value="${health_user_item.health_user_id}">
		                       <div style="width:100%;margin-left:30px;margin-top:25px;">
		                           <font>姓名：</font><span class="detail_text"  style="width:120px;"   >${health_user_item.name}</span>
		                           <font>身份证号：</font><span class="detail_text"    style="width:150px;"   >${health_user_item.id_number}</span>
		                           <font>性别：</font> <c:if test="${health_user_item.sexuality==0}">
		                                                  <span class="detail_text"  style="width:124px;"  >男</span>
		                                                  </c:if>
		                                                   <c:if test="${health_user_item.sexuality==1}">
		                                                      <span class="detail_text"  style="width:124px;"  >女</span>
		                                                  </c:if>
		                           <font>出生日期：</font><span class="detail_text"  style="width:120px;"   >${health_user_item.birth_datetime_string}</span>
		                      </div>

		                      <div style="width:100%;margin-left:30px;margin-top:10px;">
		                          <font>职业：</font><span class="detail_text" style="width:120px;"   >${health_user_item.occupation_string}</span>
		                          <font>出生城市：</font><span class="detail_text" style="width:120px;"   >${health_user_item.born_place_string}</span>
		                          <font>长居城市：</font><span class="detail_text" style="width:120px;"   >${health_user_item.residence_place_string}</span>
		                          <font>现居城市：</font><span class="detail_text" style="width:120px;"   >${health_user_item.now_place_string}</span>
		                      </div>
		                    </span>
		                    <span class="add_button">
		                          <input type="submit" class="add_button" onclick="hideDetailDiv(${health_user_item.health_user_id})" value="关闭" />
		                    </span>
		                    
		                  </div>
		                  
                     </c:forEach>
                     
                   
                    
                  </div>
              
              </td>
           </tr>
         </table>
       
   </div>
   <div class="bottom">
   
   </div>
   
   <script type="text/javascript">
   if(needShown)
	   clickAddDiv();
   </script>
   
</body>
</html>